﻿Imports DevExpress.XtraEditors
Imports System.Data.SqlClient

Public Module _Common

    'project
    Public Project_UserName, Project_UserType As String
    Public Project_Nam, Project_Thang As Integer
    Public Project_Form As String
    Public Project_FocusedColor As System.Drawing.Color
    Public Project_SoTc As String

    Public _Dtb As New DataTable
    Public _SystemF As New SysF
    Public _QuyetToanF As New QuyetToanF
    Public _PhieuXuatF As New PhieuXuatF
    Public _BaoCaoF As New BaoCaoF

    'form
    Public _frmMenu As frmMenu

    'frmDonVi
    Public frmDonVi_Exists As Boolean = False

    'frmDanhMuc_TraCuu
    Public frmDanhMuc_TraCuu_Exists As Boolean = False
    Public frmDanhMuc_TraCuu_Ma As Integer
    Public frmDanhMuc_TraCuu_Dtb As New DataTable
    Public frmDanhMuc_Dtb_DanhMuc As New DataTable

    'frmDanhMuc_CapNhat
    Public frmDanhMuc_CapNhat_AddEdit As String
    Public frmDanhMuc_CapNhat_Ma As Integer

    'frmLoaiChietTinh
    Public frmLoaiChietTinh_Exists As Boolean = False
    Public frmLoaiChietTinh_MaLoaiChietTinh As String
    Public frmLoaiChietTinh_Dtb As New DataTable

    'frmChietTinh
    Public frmChietTinh_Exists As Boolean = False

    Public frmChietTinh_AddEdit As String
    Public frmChietTinh_Dtb As New DataTable

    'frmChietTinh_CapNhat
    Public frmChietTinh_CapNhat_Exists As Boolean = False
    Public frmChietTinh_CapNhat_AddEdit As String
    Public frmChietTinh_CapNhat_SoPhieu As String
    Public frmChietTinh_CapNhat_Dtb As New DataTable

    'frmThiCong_CapNhat
    Public frmThiCong_CapNhat_AddEdit As String
    Public frmThiCong_CapNhat_Exists As Boolean = False
    Public frmThiCong_CapNhat_SoTc As String
    Public frmThiCong_CapNhat_Dtb As New DataTable

    'frmDuToan_CapNhat
    Public frmDuToan_CapNhat_Exists As Boolean = False
    Public frmDuToan_CapNhat_Dtb As New DataTable

    'frmDuToan
    Public frmDuToan_Exists As Boolean = False

    'frmNghiemThu
    Public frmNghiemThu_Exists As Boolean = False

    'frmNghiemThu_CapNhat
    Public frmNghiemThu_CapNhat_Exists As Boolean = False
    Public frmNghiemThu_CapNhat_Dtb As New DataTable

    'frmThicong
    Public frmThicong_Exists As Boolean = False

    Public frmPhieuXuat_Exists As Boolean = False
    Public frmQuyetToan_Exists As Boolean = False
    Public frmQuyetToan_CapNhat_Exists As Boolean = False

    Public _SoPhieu As String
    'Public _Dtb As DataTable
    'Public _Form As String
    Public _LoaiQt As String
    Public _SoQt As String
    Public _SoTr As String
    Public _Stt As Integer
    Public _LoaiTr As String
    Public _Chon As Boolean
    Public _DienGiai, _VeViec As String

    Public Sub Main()
        Project_FocusedColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer))

        Dim f As frmDangnhap
        f = New frmDangnhap
        f.ShowDialog()
    End Sub

    Public Sub InitComboProject_Thang(ByVal icb As DevExpress.XtraEditors.ImageComboBoxEdit)
        Dim i As Integer
        For i = 1 To 12
            icb.Properties.Items.AddRange(New DevExpress.XtraEditors.Controls.ImageComboBoxItem() {New DevExpress.XtraEditors.Controls.ImageComboBoxItem(i, i, -1)})
        Next
        icb.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Default
    End Sub

    Public Sub InitComboProject_Nam(ByVal spi As DevExpress.XtraEditors.SpinEdit)
        spi.Properties.MinValue = 2000
        spi.Properties.MaxValue = 2050
    End Sub

    Public Function ExitstValueInDTB(ByVal Value As VariantType, ByVal ColName As String, ByVal Dtb As DataTable) As Boolean
        Dim i As Integer
        For i = 0 To Dtb.Rows.Count - 1
            If Value = Dtb.Rows(i).Item(ColName) Then
                Return True
                Exit Function
            End If
        Next
        Return False
    End Function

End Module


